package com.liwenfeng.diancanspringboot.mapper;

import com.liwenfeng.diancanspringboot.pojo.entity.Setmeal;
import com.liwenfeng.diancanspringboot.pojo.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    // 新增套餐菜品关系
    @Insert("insert into setmeal_dish (setmeal_id, dish_id, name, price, copies) values (#{setmealId}, #{dishId}, #{name}, #{price},#{copies})")
    void insert(SetmealDish setmealDish);

    // 删除套餐菜品关系
    void delete(List<Long> setmealIds);

    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);

    void insertBatch(List<SetmealDish> setmealDishs);

    List<Long> getSetmealByDishIds(List<Long> dishIds);

    @Select("select * from setmeal_dish where dish_id = #{dishId}")
    List<SetmealDish> getSetmealByDishId(Long dishId);
}
